home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / python2.5-minimal.postinst < prev    next >
Text File  |  2008-10-05  |  2KB  |  70 lines

  1. #! /bin/sh
  2.  
  3. set -e
  4.  
  5. if [ ! -f /etc/python2.5/sitecustomize.py ]; then
  6.     cat <<-EOF
  7.     # Empty sitecustomize.py to avoid a dangling symlink
  8. EOF
  9. fi
  10.  
  11. if [ "$1" = configure ]; then
  12.     (
  13.     files=$(dpkg -L python2.5-minimal | sed -n '/^\/usr\/lib\/python2.5\/.*\.py$/p')
  14.     /usr/bin/python2.5 /usr/lib/python2.5/py_compile.py $files
  15.     if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then
  16.         /usr/bin/python2.5 -O /usr/lib/python2.5/py_compile.py $files
  17.     fi
  18.     )
  19.     bc=no
  20.     if [ -z "$2" ] || dpkg --compare-versions "$2" lt 2.5-3 \
  21.         || [ -f /var/lib/python/python2.5_installed ]; then
  22.     bc=yes
  23.     fi
  24.     if ! grep -sq '^supported-versions[^#]*python2.5' /usr/share/python/debian_defaults
  25.     then
  26.     # FIXME: byte compile anyway?
  27.     bc=no
  28.     fi
  29.     if [ "$bc" = yes ]; then
  30.     # new installation or installation of first version with hook support
  31.     if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  32.         echo "Linking and byte-compiling packages for runtime python2.5..."
  33.     fi
  34.     version=$(dpkg -s python2.5-minimal | awk '/^Version:/ {print $2}')
  35.     for hook in /usr/share/python/runtime.d/*.rtinstall; do
  36.         [ -x $hook ] || continue
  37.         $hook rtinstall python2.5 "$2" "$version"
  38.     done
  39.     if [ -f /var/lib/python/python2.5_installed ]; then
  40.         rm -f /var/lib/python/python2.5_installed
  41.         rmdir --ignore-fail-on-non-empty /var/lib/python 2>/dev/null
  42.     fi
  43.     fi
  44. fi
  45.  
  46. case "$1" in
  47.     configure)
  48.         # Create empty directories in /usr/local
  49.         if [ ! -e /usr/local/lib/python2.5 ]; then
  50.             mkdir -p /usr/local/lib/python2.5 2> /dev/null || true
  51.             chmod 2775 /usr/local/lib/python2.5 2> /dev/null || true
  52.             chown root:staff /usr/local/lib/python2.5 2> /dev/null || true
  53.         fi
  54.         if [ ! -e /usr/local/lib/python2.5/site-packages ]; then
  55.             mkdir -p /usr/local/lib/python2.5/site-packages 2> /dev/null || true
  56.             chmod 2775 /usr/local/lib/python2.5/site-packages 2> /dev/null || true
  57.             chown root:staff /usr/local/lib/python2.5/site-packages 2> /dev/null || true
  58.         fi
  59.  
  60.     if [ -x /usr/sbin/update-binfmts ]; then
  61.         /usr/sbin/update-binfmts --import python2.5
  62.     fi
  63.  
  64.     ;;
  65. esac
  66.  
  67.  
  68.  
  69. exit 0
  70.